package com.ocom.webapi.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ocom.common.entity.card.EntityXfSignNo;
import com.ocom.common.entity.human.EntityPersonnelInfo;
import com.ocom.common.enums.ResultEnum;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.common.utils.StringUtil;
import com.ocom.common.vo.ccb.CcbzhshAddUserVo;
import com.ocom.security.utils.SecurityUtils;
import com.ocom.webapi.feign.PayConfigClientService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

@Service
public class CcbAccountServiceImpl {
/*    @Resource
    private PayConfigClientService payConfigClientService;

    @Value("${paycenter.url}")
    private String payCenterUrl;

    public Result ccbzhshAddUser(CcbzhshAddUserVo request){
        Result entityPersonnelInfo = payConfigClientService.getOnePersonInfo(request);
        if(entityPersonnelInfo == null || entityPersonnelInfo.getCode()!= 200){
            ResultUtil.error(ResultEnum.Err_4014);
        }
        if(StringUtil.isEmpty(entityPersonnelInfo.getData().toString())){
            ResultUtil.error(ResultEnum.Err_303);
        }
        JSONObject jsonPersonnelInfo = JSON.parseObject(JSON.toJSONString(entityPersonnelInfo.getData()));
        Result entityXfSignNo = payConfigClientService.getUserSignInfo(request.getCompanyId(), request.getPId(), -1, 32, -1);
        if(entityXfSignNo == null || entityXfSignNo.getCode() != 200){
            ResultUtil.error(ResultEnum.Err_4014);
        }
        if(StringUtil.isEmpty(entityXfSignNo.getData().toString())){
            ResultUtil.error(ResultEnum.Err_303);
        }
        JSONObject jsonXfSignNo = JSON.parseObject(JSON.toJSONString(entityPersonnelInfo.getData()));
        HashMap<String,String> map = new HashMap<>();
        map.put("token","Bearer "+ SecurityUtils.getToken());
        map.put("companyId",String.valueOf(request.getCompanyId()));
        map.put("userName","");

        if(jsonXfSignNo == null || jsonXfSignNo.getInteger("status") == 0){

        }else if(jsonXfSignNo.getInteger("status") == 1){

        }

        return ResultUtil.success();
    }*/

}
